<template>
  <div>
    <h1>管理商品页面</h1>
    <p>商品名称:<input type="text" v-model="form.name"></p>
    <p>商品价钱:<input type="text" v-model="form.price"></p>
    <p>商品图片:<input type="file" id="pic"></p>
    <button @click="sp">确认添加</button>
    <button @click="fan">返回</button>
  </div>
</template>

<script>
export default {
  name: "add_shop",
  data() {
    return {
      form: {}
    }
  },
  methods: {
    sp() {
      let pic = document.getElementById('pic').files[0]
      let Form = new FormData()
      Form.append('name', this.form.name)
      Form.append('price', this.form.price)
      Form.append('pic', pic)
      this.$axios.post('users/AspAPI/', Form)
        .then(res => {
          if (res.data.code == 200) {
            alert('ok')
          } else {
            alert('no')
          }
        })
    },
    fan(){
      this.$router.go(-1)
    }
  }
}
</script>

<style scoped>

</style>
